<{include file="top_v2.html" }>
</head>
<body>
<div id="wrap" class="pb">
    <div class="header">
        我的报名
        <a href="javascript:window.history.back();" class="back"></a>
    </div>
    <ul class="active-list" style="margin-top: 1rem;">
    <{include file="Event_v2/more.html" }>
    </ul>

</body>
</html>
<script type="text/javascript">
    var loadMore = "<{U('Events/loadMore')}>";
    var channel=0;
    var page=1;
    function loadEvent(channelID){
        channel=channelID;
        page=1;
        flagAjax = true;
        $('.active-list').empty();
        load_more({page:page,channel:channel});
    }

    var muhandle =null;
    function init_mu_timer(){ //递减 class = mutimer 的元素
        if(muhandle != null)	clearInterval(muhandle);
        muhandle = setInterval("refresh_mu_timer()",999);
    }
    //时间递减队列
    function refresh_mu_timer(){
        var obj	= $(".mutimer");
        var l	= obj.size();
        if(l>0){
            for(var i=0;i<l;i++){
                var _that = obj[i];
                time = $(_that).attr('data-time');
                time	= time-1;
                obj[i].innerHTML ="倒计时: "+print_time(time);
                $(obj[i]).attr('data-time', time);
            }
        }else{
            clearInterval(muhandle);
        }
    }
    //拖动加载
    var flagData = true;
    var flagAjax = true;
    //加载
    function load_more(postData){
        if(! flagAjax){
            return false;
        }
        flagAjax = false;
        loadObj = layer.load(2);
        $.getJSON(loadMore,postData , function(data){
            layer.close(loadObj);
            if (data.status != 0) {
                layer.msg("数据获取失败，请稍后重试或联系管理员解决！");
            } else {
                ++page;
                $(".active-list").append(data.dataHTML);
                fixUserHead();
                if (data.isPage) flagAjax = true;
            }

        },'json');
    }

    var tmp_scroll = 0;
    //拖动加载
    function scroll_load(postData){
        if (tmp_scroll == $(window).height() + $(window).scrollTop()) {
            return;
        }
        tmp_scroll = $(window).height() + $(window).scrollTop();
        var jia_scroll = $(document).height() - ($(window).height() + $(window).scrollTop());
        if (jia_scroll < 100 && flagData) {
            load_more(postData);
        }
    }

    $(window).scroll(function(){
        if(page==1) page=2;
        scroll_load({page:page,channel:channel});
    });

    function checkTask(e,i){
        var param = {id:i};
        $.getJSON("<{U('Events/checkUserTask')}>",param,function(data){
            if(data.status ==1){
                layer.msg(data.msg);
                return false;
            }else if(data.status == 2){
                var len = data.data.length;
                for(var i=0;i<len;i++){
                    alert("您的“"+data.data[i]+"”活动作业未提交，请先提交作业");
                }
                return false;
            } else{
                var url = $(e).attr("href");
                window.location.href= url;
                return true;
            }
        });
    }


</script>
